import Taro from "@tarojs/taro";
/**
 * @description 获取当前页url
 */
export const getCurrentPageUrl = () => {
    let pages = Taro.getCurrentPages()
    let currentPage = pages[pages.length - 1]
    let url = currentPage.route
    return url
}
/**
 * @description 获取上一页url
 */
export const getLastPageUrl = () => {
    let pages = Taro.getCurrentPages()
    let currentPage = pages[pages.length - 2]
    let url = currentPage.route
    return url
}


export const pageToLogin = () => {
    let path = getCurrentPageUrl()
    console.log("path",path)
    Taro.clearStorage()
    if (!path.includes('login')) {
        Taro.redirectTo({ url: "/pages/view/login/index" });
    }
}